﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport"/>
    <meta name="msapplication-tap-highlight" content="no" />
    <title>JavaScript TreeMap - Mobile Example</title>
    <link rel="stylesheet" href="../styles/demo.css" type="text/css" />
    <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
    <link rel="stylesheet" href="../../jqwidgets/styles/jqx.windowsphone.css" type="text/css" />
    <link rel="stylesheet" href="../../jqwidgets/styles/jqx.blackberry.css" type="text/css" />
    <link rel="stylesheet" href="../../jqwidgets/styles/jqx.android.css" type="text/css" />
    <link rel="stylesheet" href="../../jqwidgets/styles/jqx.mobile.css" type="text/css" />
    <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script>
    <script type="text/javascript" src="../simulator.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxtreemap.js"></script>
    <style>
        .jqx-treemap-legend {
            width: 60%;
            background: rgba(0, 0, 0, 0.4);
        }
    </style>
    <script type="text/javascript">
        $(document).ready(function () {
            var theme = prepareSimulator("treemap");
            var source =
             {
                 datatype: "tab",
                 datafields: [
                     { name: 'Year' },
                     { name: 'HPI' },
                     { name: 'BuildCost' },
                     { name: 'Population' },
                     { name: 'Rate' }
                 ],
                 url: '../../demos/sampledata/homeprices.txt'
             };

            var dataAdapter = new $.jqx.dataAdapter(source, { async: false, autoBind: true, loadError: function (xhr, status, error) { alert('Error loading "' + source.url + '" : ' + error); } });

            $('#treemap').jqxTreeMap({
                width: '100%',
                height: '100%',
                source: dataAdapter,
                displayMember: 'Year',
                valueMember: 'Rate',
                
                colorMode: 'rangeColors',
                colorRanges: [
                    { min: 0.02, max: 0.03, color: '#ff0300' },
                    { min: 0.03, max: 0.04, color: '#fe2e00' },
                    { min: 0.04, max: 0.05, color: '#fe3900' },
                    { min: 0.05, max: 0.06, color: '#ff5400' },
                    { min: 0.06, max: 0.07, color: '#fe7500' },
                    { min: 0.07, max: 0.08, color: '#fe8200' },
                    { min: 0.08, max: 0.09, color: '#ffed00' },
                    { min: 0.09, max: 0.1, color: '#b8db00' },
                    { min: 0.1, max: 0.11, color: '#7fbf00' },
                    { min: 0.11, max: 0.12, color: '#50a600' },
                    { min: 0.12, max: 0.15, color: '#008000' }
                ],
                legendScaleCallback: function (v) {
                    return v;
                },
                legendLabel: 'Interest Rate'
            });
            initSimulator("treemap");
        });
    </script>
</head>
<body style="background: white;">
    <div id="demoContainer" class="device-mobile-tablet">
        <div id="container" class="device-mobile-tablet-container">
            <div id="treemap"></div>
        </div>
    </div>
</body>
</html>
